//
// Created by 1065246 on 2023/3/31.
//
//初始化列表的作用:用于初始化const成员变量
#include <iostream>
#include "People.h"
//初始化列表,先初始化父列表，在对自己的属性进行初始化
People::People(int paAge, string myname, int myage) : MyParent(myage), name(myname), age(myage) {}

//初始化列表初始化常量,只对部分属性初始化
People::People(string myname, int myage, string Myparent): MyParent(myage),name(myname),age(myage),parent(Myparent) {
}

int People::getAge() {
    return this->age;
}
void People::peopleMsg() {
    cout<<"myAge:"<< this->age<<endl;
    cout<<"myName:"<< this->name<<endl;
    cout<<"myParent:"<< this->parent<<endl;
}

